package com.foo.aop.Aspect;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;

@Aspect
public class SystemArchitecture 
{
	  /**
	   * A join point is in the service layer if the method is defined
	   * in a type in the com.foo.DataProvider package or any sub-package
	   * under that.
	   */
	  @Pointcut("within(com.foo.DataProvider..*)")
	  public void inProviderServiceLayer() {}
	  
	  /**
	   * A join point is in the writer service layer if the method is defined
	   * in a type in the com.foo.Writer package or any sub-package
	   * under that.
	   */
	  @Pointcut("within(com.foo.Writer..*)")
	  public void inWriterServiceLayer() {}
	  
	  /**
	   * A join point is in the writer service layer if the method is defined
	   * in a type in the com.foo.Writer package or any sub-package
	   * under that.
	   */
	  @Pointcut("inProviderServiceLayer() && inWriterServiceLayer()")
	  public void inServiceLayer() {}
	  
	  /**
	   * A join point is in the data access layer if the method is defined
	   * in a type in the com.foo.DAO package or any sub-package
	   * under that.
	   */
	  @Pointcut("within(com.foo.DAO..*)")
	  public void inDataAccessLayer() {}

	  /**
	   * A business service is the execution of any method defined on a service
	   * interface. This definition assumes that interfaces are placed in the
	   * "service" package, and that implementation types are in sub-packages.
	   */
	  @Pointcut("execution(* com.foo.DataProvider.*.*(..))")
	  public void providerBusinessService() {}
	  
	  /**
	   * A business service is the execution of any method defined on a service
	   * interface. This definition assumes that interfaces are placed in the
	   * "service" package, and that implementation types are in sub-packages.
	   */
	  @Pointcut("execution(* com.foo.Writer.*.*(..))")
	  public void writerBusinessService() {}
	  
	  /**
	   * A business service is the execution of any method defined on a service
	   * interface. This definition assumes that interfaces are placed in the
	   * "service" package, and that implementation types are in sub-packages.
	   */
	  @Pointcut("writerBusinessService() && providerBusinessService()")
	  public void businessService() {}
	  
	  /**
	   * A data access operation is the execution of any method defined on a 
	   * dao interface. This definition assumes that interfaces are placed in the
	   * "dao" package, and that implementation types are in sub-packages.
	   */
	  @Pointcut("execution(* com.foo.DAO.*.*(..))")
	  public void dataAccessOperation() {}


}
